#include "ClaveInt.h"

ClaveInt::ClaveInt(unsigned int num) {
	this->num = num;
	this->tamanio = TAM_NUM;
	this->tipo = CLAVE_INT;
}

ClaveInt::ClaveInt(char* num) {
	this->num = Util::charToInt(num);
	this->tamanio = TAM_NUM;
	this->tipo = CLAVE_INT;
}


char* ClaveInt::toChar() {
	return Util::intToChar(num, TAM_NUM);
}

bool ClaveInt::operator==(Clave& n) {
	ClaveInt* c = (ClaveInt*) &n;
	if (num == c->num)
		return true;
	return false;
}

bool ClaveInt::operator>=(const ClaveInt& n) {
	if (num >= n.num)
		return true;
	return false;
}

bool ClaveInt::operator<=(const ClaveInt& n) {
	if (num <= n.num)
		return true;
	return false;
}

bool ClaveInt::operator>(const Clave& n) {
	ClaveInt* c = (ClaveInt*) &n;
	if (num > c->num)
		return true;
	return false;
}

bool ClaveInt::operator<(const Clave& n) {
	ClaveInt* c = (ClaveInt*) &n;
	if (num < c->num)
		return true;
	return false;
}

unsigned int ClaveInt::getTamanio() {
	return TAM_NUM;
}

string ClaveInt::mostrar() {
	stringstream ss;
	ss << num;
	return ss.str();
}

char ClaveInt::getTipo(){
	return this->tipo;
}

ClaveInt::~ClaveInt() {

}
